// request.js
const baseUrl = "http://localhost:8081/" 

const request = (url, method, data) => {
  return new Promise((resolve, reject) => {
    uni.request({
      url: baseUrl + url,
      method,
      data,
      success: res => resolve(res.data),
      fail: err => reject(err),
    });
  });
};

export const get = (url, params) => {
  return request(url, 'GET', params);
};

export const post = (url, data) => {
  return request(url, 'POST', data);
};